<ui:composition template="/WEB-INF/templates/main-template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="sidebar">
		<ui:include src="/WEB-INF/templates/public-sidebar.xhtml" />
	</ui:define>
	<ui:define name="content">
		<h:form>
			<h:outputText value="#{msg['createservicegroup.label.heading']}" styleClass="outputTextTitle" />
			<p:growl />
			<h:panelGrid columns="3">
				<h:outputLabel value="Module" />
				<h:outputLabel value=" : " />
				<p:selectOneMenu value="#{createServiceGroup.selectedModuleId}" styleClass="adminSelectOneMenuWidth" style = "width:136px;">
					<f:selectItems value="#{createServiceGroup.modulesMap}" />
				</p:selectOneMenu>

				<h:outputLabel value="#{msg['servicegroupname.label']} " />
				<h:outputLabel value=" : " />
				<p:inputText value="#{createServiceGroup.serviceGroup.servicegroupName}"  />

				<h:outputLabel value="#{msg['displayname.label']} " />
				<h:outputLabel value=" : " />
				<p:inputText value="#{createServiceGroup.serviceGroup.displayName}" />

				<h:outputLabel value="#{msg['description.label']} " />
				<h:outputLabel value=" : " />
				<p:inputTextarea value="#{createServiceGroup.serviceGroup.description}" />

				<h:inputHidden />
				<h:inputHidden />

			</h:panelGrid>
			
		<p:commandButton value="#{createServiceGroup.assignServiceGroupButtonLabel}" actionListener="#{createServiceGroup.toggleAssignPanelDisplay}" update="assignPanel" ajax="false" />	
		
		<p:panel id="assignPanel" style="width: 100%" rendered="#{createServiceGroup.assignServicesToServiceGroup}">
		 <h:panelGrid style="width: 100%; text-align: left; ">
		    <h:outputText value="Available Services" styleClass="outputTextSubTitle" />
								<p:dataTable id="servicesTable" style="width: 100%"
									value="#{createServiceGroup.services}"
									selection="#{createServiceGroup.selectedServices}" var="row"
									selectionMode="multiple" rowKey="#{row.serviceId}">
									<p:column>
										<f:facet name="header">
											<h:outputText value="Service Name" />
										</f:facet>
										<h:outputText value="#{row.serviceName}" />
									</p:column>
									<p:column>
										<f:facet name="header">
											<h:outputText value="Display Name" />
										</f:facet>
										<h:outputText value="#{row.displayName}" />
									</p:column>
									<p:column>
										<f:facet name="header">
											<h:outputText value="Description" />
										</f:facet>
										<h:outputText value="#{row.description}" />
									</p:column>
									

								</p:dataTable>
								<p:commandButton value="Assign selected Service(s) to Service Group"
									style="float:right;" actionListener="#{createServiceGroup.assignServiceAction}" update="@form"  />
									
		   <h:outputText value="Added Service Details" styleClass="outputTextSubTitle" />

			<p:dataTable value="#{createServiceGroup.assignedServices}" var="row" binding="#{createServiceGroup.assignedServicesTable}">
					
					<p:column>
						<f:facet name="header">
							<h:outputText value="Service Name" />
						</f:facet>
						<h:outputText value="#{row.serviceName}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="Display Name" />
						</f:facet>
						<h:outputText value="#{row.displayName}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="Description" />
						</f:facet>
						<h:outputText value="#{row.description}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="Operation" />
						</f:facet>
						<p:commandButton icon="ui-icon-close" title="Remove from list"
							actionListener="#{createServiceGroup.removeService}"
							update="@form" style="padding: 0"/>
					</p:column>

				</p:dataTable>
		</h:panelGrid>
			
		</p:panel>	
		<p:commandButton value="Save Service Group" actionListener="#{createServiceGroup.saveServiceGroup}" ajax="false" />
		
		<!-- 	<p:commandButton value="Assign Services" />
			
			<p:commandButton value="Assign selected Service(s)"
				style="float: right;" />
			<h:panelGrid
				style="width: 100%; text-align: left; padding-top: 10px; ">
				<h:outputText value="Assigned Servcies Details"
					styleClass="outputTextTitle" style="font-size: 16px;" /> -->

				

		</h:form>
	</ui:define>
</ui:composition>

